package io.gitee.tianhaoran.chat.sdk.provider;

import lombok.Getter;
import io.gitee.tianhaoran.chat.sdk.api.ChatBlender;
import io.gitee.tianhaoran.chat.sdk.api.universal.SupplierConfig;
import io.gitee.tianhaoran.chat.sdk.provider.chatgpt.config.ChatgptFactory;

/**
 *
 * <p>
 * 作者：沈自在
 **/
@Getter
public enum SupplierType {

    /**
     * ChatGPT 工厂
     */
    CHATGPT("ChatGPT", ChatgptFactory.instance());

    /**
     * 渠道名称
     */
    private final String name;

    /**
     * 厂商操作实体
     */
    private final BaseProviderFactory<? extends ChatBlender, ? extends SupplierConfig> providerFactory;


    SupplierType(String name, BaseProviderFactory<? extends ChatBlender, ? extends SupplierConfig> providerFactory) {
        this.name = name;
        this.providerFactory = providerFactory;
    }

    /**
     * 根据名称获取厂商枚举
     */
    public SupplierType acquireByName(String name) {
        for (SupplierType supplierType : SupplierType.values()) {
            if (supplierType.getName().equals(name)) {
                return supplierType;
            }
        }
        return null;
    }
}
